package com.javatom.notes.feign.web;


import com.javatom.notes.common.model.BaseResponse;
import com.javatom.notes.feign.service.FeignMongoOperatService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/mongo")
@Slf4j
public class FeignMongoOperatControllor {
    @Resource
   private FeignMongoOperatService feignMongoOperatService;
   @Value("${spring.application.name}")
   private String applicationName;
    @Value("${server.port}")
    private String port;
  //  @ApiOperation(value = "测试mongo批量插入数据")
   @RequestMapping(value = {"/initData"}, method = {RequestMethod.GET})
   public BaseResponse initData() {
       log.error("applicationName {}",applicationName);
       BaseResponse a=  feignMongoOperatService.initData(applicationName+":"+port);
       log.error("initData {}",a);
      return a;
   }
}
